﻿using UnityEngine;
using System.Collections;

public class moveCamera : MonoBehaviour
{

    public GameObject obj;//鸭子
    private Vector3 v3;
    private Vector3 v2;
    void Start()
    {
        v3 = transform.position - obj.transform.position;
        v2 = transform.position;
    }

    void Update()
    {
        Vector3 vobj = obj.transform.position;
        transform.position = obj.transform.position + v3;
        transform.position = new Vector3(vobj.x + v3.x, v2.y, vobj.z + v3.z);
    }
}
